﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace BesAsm.Emgaats.Core
{
  public class Simulation
  {
    private string _hydraulicsFile = String.Empty;
    private string _hydrologyFile = String.Empty;
    private int _id = 0;
    private string _name = String.Empty;
    private string _title1 = String.Empty;
    private string _title2 = String.Empty;
    private bool _useBaseflow = false;
    private string _stormAbbreviation = String.Empty;

    /// <summary>
    /// Storm ID (primary key on database)
    /// </summary>
    public int Id
    {
      get
      {
        return _id;
      }
      set
      {
        _id = value;
        PropertyChangedEventArgs args = new PropertyChangedEventArgs("Id");
        OnPropertyChanged(args);
      }
    }

    /// <summary>
    /// Name of storm for display
    /// </summary>
    public string Name 
    {
      get
      {
        return _name;
      }
      set
      {
        _name = value;
        PropertyChangedEventArgs args = new PropertyChangedEventArgs("Name");
        OnPropertyChanged(args);
      }
    }

    /// <summary>
    /// Filename for hydrology model input file
    /// </summary>
    public string HydrologyFile 
    {
      get
      {
        return _hydrologyFile;
      }
      set
      {
        _hydrologyFile = value;
        PropertyChangedEventArgs args = new PropertyChangedEventArgs("HydrologyFile");
        OnPropertyChanged(args);
      }
    }

    /// <summary>
    /// Filename for hydraulics model input file
    /// </summary>
    public string HydraulicsFile 
    {
      get
      {
        return _hydraulicsFile;
      }
      set
      {
        _hydraulicsFile = value;
        PropertyChangedEventArgs args = new PropertyChangedEventArgs("HydraulicsFile");
        OnPropertyChanged(args);
      }
    }

    /// <summary>
    /// True if baseflow numbers should be generated
    /// </summary>
    public bool UseBaseflow 
    {
      get
      {
        return _useBaseflow;
      }
      set
      {
        _useBaseflow = value;
        PropertyChangedEventArgs args = new PropertyChangedEventArgs("UseBaseflow");
        OnPropertyChanged(args);
      }
    }

    /// <summary>
    /// First title for describing simulation
    /// </summary>
    public string Title1
    {
      get
      {
        return _title1;
      }
      set
      {
        _title1 = value;
        PropertyChangedEventArgs args = new PropertyChangedEventArgs("Title1");
        OnPropertyChanged(args);
      }
    }

    /// <summary>
    /// Second title for describing simulation
    /// </summary>
    public string Title2
    {
      get
      {
        return _title2;
      }
      set
      {
      	_title2 = value;
        PropertyChangedEventArgs args = new PropertyChangedEventArgs("Title2");
        OnPropertyChanged(args);
      }
    }
    
    /// <summary>
    /// Storm abbreviation code
    /// </summary>
    public string StormAbbreviation
    {
      get
      {
        return _stormAbbreviation;
      }
      set
      {
        _stormAbbreviation = value;
      }

    }

    public event PropertyChangedEventHandler PropertyChanged = delegate { };

    protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
    {
      if (PropertyChanged != null)
        PropertyChanged(this, e);
    }

    public string ToString()
    {
      return string.Format("{0}:{1}", Id, Name);
    }
  }
}
